package com.junqson.je.content.repo;

import com.junqson.je.content.model.CommentModel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;

/**
 * @Descriptions
 * @Company
 * @Author Junqson
 * @Date 2020/2/11 8:46
 * @Version 1.0
 */
@Repository
public interface CommentRepo extends JpaRepository<CommentModel, Long> {
    Page<CommentModel> findByPostId(Long postId, Pageable pageable);

    Long countAllByPostId(Long postId);

    @Transactional
    void deleteAllByPostId(Long postId);
}
